package cn.tedu.micro.device.service.impl;

import cn.tedu.micro.common.vo.GunIngoVO;
import cn.tedu.micro.device.dao.mapper.GunInfoMapper;
import cn.tedu.micro.device.dao.repository.DeviceRepository;
import cn.tedu.micro.device.po.GunInfoPO;
import cn.tedu.micro.device.service.DeviceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class DeviceServiceimpl  implements DeviceService {
    /*@Autowired
    private GunInfoMapper gunInfoMapper;*/
@Autowired
private DeviceRepository deviceRepository;
    @Override
    public GunIngoVO checkGunStatus(Integer id) {
        GunIngoVO vo = null;
       // GunInfoPO po = gunInfoMapper.selectById(id);
        GunInfoPO po =deviceRepository.getGunById(id);
        if (po != null) {
            log.info("查询结果不为空");
            vo = new GunIngoVO();
            BeanUtils.copyProperties(po,vo);
        }else {
            log.info("查询结果为空");
        }
        return vo;
    }
}
